package com.zdxlz.fcmp.common.core.constant.enums;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description：
 * @Author：aman
 * @Data 2025/3/18 15:12
 */
@Getter
@AllArgsConstructor
public enum RequestMethodEnum {

    GET(1, "GET"),
    POST(2, "POST"),
    PUT(3, "PUT"),
    DELETE(4, "DELETE"),
    ;

    @EnumValue
    private final Integer code;
    private final String name;

    public static RequestMethodEnum getByCode(Integer code) {
        for (RequestMethodEnum methodEnum : RequestMethodEnum.values()) {
            if (methodEnum.getCode() == code) {
                return methodEnum;
            }
        }
        return null;
    }

    @JsonValue
    public int getCode() {
        return code;
    }
}
